Skip to main content

revXMLCreateTreeFromFile

Type

function

Summary

Reads an XML file, optionally creating an XML tree.

Syntax

revXMLCreateTreeFromFile(<filePath>, <parseBadData>, <createTree>, <sendMessages>)

Description

Use the revXMLCreateTreeFromFile function to read the contents of an XML document and create an XML tree from it in memory.

If the parseBadData is true, the revXMLCreateTreeFromFile function tries to parse XML data even if it is not well-formed. Otherwise, the function stops executing as soon as it encounters data that is not well-formed XML.

If the createTree is true, the function creates a tree structure in memory. Otherwise, the function simply parses the XML data without creating an XML tree.

If the sendMessages is true, the revXMLStartTree, revStartXMLNode, revStartXMLData, revEndXMLNode, and revXMLEndTree messages are sent while the file is being parsed. Otherwise, these messages are not sent.

If the revXMLCreateTreeFromFile function encounters an error, it returns an error message starting with "xmlerr".

Important

The revXMLCreateTreeFromFile function is part of the XML library. To ensure that the function works in a standalone application, you must include this custom library when you create your standalone. In the Inclusions pane of the Standalone Application Settings window, make sure the "XML" checkbox is checked.

Parameters

NameTypeDescription

filePath

The name and location of a file containing XML text.

parseBadData

bool

createTree

bool

sendMessages

bool

Examples

revXMLCreateTreeFromFile("New.xml",false,true,false)
if revXMLCreateTreeFromFile(it,true,true,false) then next repeat

glossary: LiveCode custom library, return, XML tree, Standalone Application Settings, message, standalone application, XML, XML document, command, function

keyword: file, integer

library: XML library

message: revStartXMLData, revStartXMLNode, revEndXMLNode, revXMLStartTree, revXMLEndTree

command: revXMLDeleteAllTrees, revXMLAppend

control structure: function

function: revXMLValidateDTD, revXMLTrees

Compatibility and Support

Introduced

LiveCode 2.0

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?